import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
//国际化
//@ts-ignore 忽略当前ts文件报红的错误,不设置这个在打包的时候会报错
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
//引入element-plus的icons
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
//引入路由
import router from './router/index'
//引入大仓库
import pinia from './store/index'
//引入全局路由守卫
import '@/permisstion.ts'

const app = createApp(App)
 
//使用ElementPlus,并设置国际化
app.use(ElementPlus, {
    locale: zhCn,
})

//使用路由
app.use(router)

//使用大仓库
app.use(pinia)

//全局注册icon图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
 
//挂载到app上
app.mount('#app')